package mi.payment.controller;

import mi.payment.db.PayDetailModel;
import mi.payment.db.SettlementModel;
import mi.payment.settings.SystemParamsOperation;

/**
 * @author Created by longx on 2017/7/23.
 */

public abstract class BaseSettlementResetTableController {

    public void resetSettlementTable() {
        SystemParamsOperation systemParamsOperation = SystemParamsOperation.getInstance();
        PayDetailModel payDetailModel = PayDetailModel.getInstance();
        payDetailModel.deleteAll();
        // 结算成功时清空交易汇总表，再使用结算时PosP返回的批次号插入一条新的纪录
        String batchNumber = systemParamsOperation.getSystemParamsSettings().getBatchNumStart();
        SettlementModel settlementModel = SettlementModel.getInstance();
        settlementModel.emptyTableData();
        settlementModel.insertByBatchNo(batchNumber);
    }

}
